using System;
using System.Collections;

namespace Less.Util
{
    public static class Msg
    {
        // TODO: For translate messages extract them to localizable resources and insert language parameter


        public static string Executing(string param, string culture="")
        {
            string msg = Config.GetValue("Msg.Executing", "Executing {0}",true,culture);
            return String.Format(msg, param);
        }
    
        public static string PathNotFound(object param, string culture = "")
        {
            string msg = Config.GetValue("Msg.PathNotFound", "File {0} could not be found", true, culture);
            return String.Format(msg, param);
        }

        public static string NotFound(object param, string culture = "")
        {
            string msg = Config.GetValue("Msg.NotFound", "Could not find results for: {0}", true, culture);
            return String.Format(msg, param);
        }
        public static string TooManyFound(object param, string culture = "")
        {
            string msg = Config.GetValue("Msg.TooManyFound", "Too many results for: {0}", true, culture);
            return String.Format(msg, param);
        }
        public static string Found(object param, object result = null, string culture = "")
        {
            int count = 1;
            if (result != null)
            {
                var list = result as IList;
                if (list != null)
                {
                    count = list.Count;
                }
            }
            string msg = Config.GetValue("Msg.Found", "Found {1} results for :{0}", true, culture);
            return String.Format(msg, param,count);
        }
    
        public static string ValueCannotBeEmpty(string culture="")
        {
            string msg = Config.GetValue("Msg.ValueCannotBeEmpty", "Value cannot be empty", true, culture);
            return msg;
        }
        public static string ErrorExecutingQuery(string culture="")
        {
            string msg = Config.GetValue("Msg.ErrorExecutingQuery", "Error executing query", true, culture);
            return msg;
        }
        public static string AlreadyExists(object param, string culture = "")
        {
            string msg = Config.GetValue("Msg.AlreadyExists", "{0} already exists", true, culture);
            return String.Format(msg, param);
        }
        public static string InvalidConversion(string culture = "")
        {
            string msg = Config.GetValue("Msg.InvalidConversion", "Invalid Conversion", true, culture);
            return msg;
        }
        public static string NotInserted(string param, string culture = "")
        {
            string msg = Config.GetValue("Msg.NotInserted", "{0} NotInserted", true, culture);
            return String.Format(msg, param);
        }
    }
}